package com.nthink.indicators.controller;

import com.nthink.indicators.pojo.operationindex.workload.*;
import com.nthink.indicators.pojo.pie.PieDataModel;
import com.nthink.indicators.service.operationindex.WorkloadService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

/**
 * @author Angus Yu
 * @date 2021-03-31 16:23
 */
@Api(tags = "运行指标")
@RestController
public class OperationIndexController {

    @Autowired
    private WorkloadService workloadService;

    @ApiOperation("工作负荷（医务科）年人次数据")
    @GetMapping("/getYearData")
    public WorkloadYear getYearData(@RequestParam(required = true) Integer year) {
        WorkloadYear workloadYear = workloadService.getYearData(year);
        return workloadYear;
    }

    @ApiOperation("工作负荷（医务科）年床位数据")
    @GetMapping("/getYearBedData")
    public WorkloadBedYear getYearBedData(@RequestParam(required = true) Integer year) {
        WorkloadBedYear workloadYear = workloadService.getYearBedData(year);
        return workloadYear;
    }

    @ApiOperation("工作负荷（医务科）基础数据")
    @GetMapping("/getWorkloadData")
    public Workload getWorkloadData(@RequestParam(required = false) Date startTime, @RequestParam(required = false) Date endTime) {
        Workload workload = workloadService.getData(startTime, endTime);
        return workload;
    }

    @ApiOperation("工作负荷（医务科）药品数据")
    @GetMapping("/getDrugData")
    public WorkloadDrug getDrugData(@RequestParam(required = false) Date startTime, @RequestParam(required = false) Date endTime) {
        WorkloadDrug workload = workloadService.getDrugData(startTime, endTime);
        return workload;
    }


    @ApiOperation("工作负荷（医务科）手术分布数据")
    @GetMapping("/getOperationInfo")
    public List<PieDataModel> getOperationInfo(@RequestParam(required = false) Date startTime, @RequestParam(required = false) Date endTime) {
        return  workloadService.getOperationInfo(startTime, endTime);
    }



}
